/*
  Copyright (c) 2010 Les Newell. All rights reserved

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef MAINFRAME_H
#define MAINFRAME_H

#ifndef WX_PRECOMP
//(*HeadersPCH(MainFrame)
#include <wx/scrolwin.h>
#include <wx/menu.h>
#include <wx/textctrl.h>
#include <wx/listbox.h>
#include <wx/button.h>
#include <wx/frame.h>
//*)
#endif
//(*Headers(MainFrame)
#include <wx/splitter.h>
//*)

#include "ModuleData.h"

class MainFrame: public wxFrame
{
public:

    MainFrame(wxWindow* parent=0);
    virtual ~MainFrame();

protected:

    //(*Declarations(MainFrame)
    wxButton* btnConnect;
    wxMenu* Menu3;
    wxMenuItem* mnuPort;
    wxSplitterWindow* splitterLog;
    wxTextCtrl* txtCommand;
    wxTextCtrl* txtLog;
    wxMenu* Menu1;
    wxListBox* lbModules;
    wxMenuBar* MenuBar1;
    wxMenuItem* mnuGetModules;
    wxSplitterWindow* splitterModules;
    wxScrolledWindow* swSignals;
    wxMenu* Menu2;
    wxMenuItem* mnuSave;
    //*)

    //(*Identifiers(MainFrame)
    //*)

private:

    //(*Handlers(MainFrame)
    void OnbtnConnectClick(wxCommandEvent& event);
    void OnmnuLoadSelected(wxCommandEvent& event);
    void OnmnuSaveSelected(wxCommandEvent& event);
    void OnmnuQuitSelected(wxCommandEvent& event);
    void OnmnuGetModulesSelected(wxCommandEvent& event);
    void OnmnuWriteSelected(wxCommandEvent& event);
    void OnmnuAboutSelected(wxCommandEvent& event);
    void OnlbModulesSelect(wxCommandEvent& event);
    void OnmnuPortSelected(wxCommandEvent& event);
    //*)

    void OntxtCommandKey(wxKeyEvent& event);
    void OnsigValueTextEnter(wxCommandEvent& evt);
    void OnmonitorClick(wxCommandEvent& evt);
    void OnList(wxStringEvent& evt);
    void OnConnect(wxCommandEvent& evt);
    void OnLog(wxStringEvent& evt);
    void ShowModule(int idx);

    Serial* m_serial;
    ModuleData m_data;
    Module * m_curModule;
    wxLogTextCtrl* m_log;
    wxString m_currentVersion;
    bool m_compact;

    DECLARE_EVENT_TABLE()
};

#endif
